import _ from 'underscore'
import $ from 'jquery'
import {Scope} from 'lib/scopeFactory'
import traceDetail from '../apis/traceDetail'
import basicInfo from '../apis/basicInfo'
export default class MainScope extends Scope {
  constructor(props){
    super(props);
    this.traceId = props.routeParams.traceId
    this.$state = {
      trace:null
    }
    this.modelApi = traceDetail({
      id:this.traceId,
      startTime:props.routeParams.timestamp,
      endTime:props.routeParams.timestamp,
      urlName:'httptransactiondetail'
    })
  }
  fetch(){
    var _this = this
    this.modelApi.fetch().then((data,params) => {
      this.$state.trace = data
    },(err) => {
      this.$state.trace = {
        error:err
      }
    }).always(() => {
      this.emit()
    })
  }
  $load(){
    this.fetch();
  }
}
